Skip to content

Return HTTP status on errors and add a request timeout - #12

Merged
stremovsky merged 1 commit into
mainfrom
error-status-and-timeout
Nov 27, 2026
Merged

stremovsky merged 1 commit into
mainfrom
error-status-and-timeout

Conversation

@stremovsky

Copy link
Copy Markdown
Contributor
  • Error results keep status and message and add httpcode (the HTTP status) when the server answered, so callers can tell 404 / 409 / 403 apart without matching message text. A non-JSON reply (e.g. a proxy's 502 page) also returns an error with httpcode.
  • New timeout argument, passed to every request (raw_request too). Default (10, 300): 10 s to connect, 300 s to read. None keeps the old wait-forever behaviour.
  • tests/test_http_errors.py: 8 offline tests against a local stub server (status codes, HTML reply, refused connection, timeouts).
  • README: "Errors and timeouts" section, linking to the docs' error reference.

Behaviour change: calls used to wait forever; now they give up after 300 s without a response.

No version bump in this PR.

🤖 Generated with Claude Code

Error results now carry httpcode; requests time out after (10, 300) s by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stremovsky
stremovsky merged commit 5611bfe into main Nov 27, 2026
13 checks passed
@stremovsky
stremovsky deleted the error-status-and-timeout branch November 27, 2026 15:06
@stremovsky stremovsky mentioned this pull request Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant